package com.gbr.client.presentation.impl;

import java.awt.Rectangle;

import com.gbr.application.action.ExportAction;
import com.gbr.application.action.RecordAction;
import com.gbr.application.action.SelectAreaAction;
import com.gbr.application.action.ShowRecordingAreaAction;
import com.gbr.application.model.Capture;
import com.ng.framework.service.action.IActionService;

public class RecordingDelegate {
    public static void selectRecordingArea(final IActionService actionService) {
        SelectAreaAction action = new SelectAreaAction(true);
        actionService.fireAction(action);
    }

    public static void showRecordingArea(final IActionService actionService, final Rectangle rect, final boolean value) {
        ShowRecordingAreaAction action = new ShowRecordingAreaAction(value, rect);
        actionService.fireAction(action);
    }

    public static void startRecording(final IActionService actionService, final String name, final Rectangle rect) {
        showRecordingArea(actionService, rect, true);

        RecordAction action = new RecordAction(true, name, rect);
        actionService.fireAction(action);
    }

    public static void stopRecording(final IActionService actionService, final Rectangle rect) {
        showRecordingArea(actionService, rect, false);

        RecordAction action = new RecordAction(false, null, null);
        actionService.fireAction(action);
    }

    public static void export(final IActionService actionService, final Capture capture, final String file) {
        ExportAction action = new ExportAction(capture.getId(), file);
        actionService.fireAction(action);
    }
}
